package labox.innovation.config;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import labox.innovation.util.L2Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TelnetConfig {
    private static final Logger _log = LoggerFactory.getLogger(TelnetConfig.class.getName());

    private static final String TELNET_FILE = "./config/telnet.properties";

    public static boolean IS_TELNET_ENABLED;

    public static void load() {
        _log.info("Loading telnet Configuration Files...", Config.SERVER_ID);
        InputStream is = null;
        try {
            L2Properties telnetSettings = new L2Properties();
            is = new FileInputStream(new File(TELNET_FILE));
            telnetSettings.load(is);
            IS_TELNET_ENABLED = Boolean.parseBoolean(telnetSettings.getProperty("EnableTelnet", "false"));
        } catch (Exception e) {
            _log.error("Failed to Load " + TELNET_FILE + " File.", e);
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                _log.error("InputStream close occured IOException");
            }
        }
    }
}
